﻿using System.Windows.Controls;
using MyOS.Models;
using MyOS.Utils;

namespace MyOS.Views
{
    public partial class VirtualAboutView : UserControl
    {
        private SystemInfoItemModel _system;


        public VirtualAboutView()
        {
            InitSystemInfo();
            InitializeComponent();
            SystemInfo = _system;
            DataContext = SystemInfo;
        }

        private void InitSystemInfo()
        {
            _system = new SystemInfoItemModel
            {
                Name = IniUtils.ReadString("System", "SystemName", "MyOperationSystem", "./config.ini"),
                Time = IniUtils.ReadString("System", "CreateTime", "", "./config.ini"),
                DiskCSize = IniUtils.ReadInteger("DiskC", "Size", 4096, "./config.ini"),
                DiskDSize = IniUtils.ReadInteger("DiskD", "Size", 4096, "./config.ini"),
                DiskCRootSize = IniUtils.ReadInteger("DiskC", "RootSize", 5, "./config.ini"),
                DiskCBlockSize = IniUtils.ReadInteger("DiskC", "BlockSize", 64, "./config.ini"),
                DiskCBlockCount = IniUtils.ReadInteger("DiskC", "BlockCount", 64, "./config.ini"),
                DiskCRecordCount = IniUtils.ReadInteger("DiskC", "RecordCount", 0, "./config.ini"),
                DiskCRootOffset = IniUtils.ReadInteger("DiskC", "RootOffset", 2, "./config.ini"),
                DiskCFileStart = IniUtils.ReadInteger("DiskC", "FileStart", 7, "./config.ini"),
                DiskCTime = IniUtils.ReadString("DiskC", "CreateTime", "", "./config.ini"),

                DiskDRootSize = IniUtils.ReadInteger("DiskD", "RootSize", 5, "./config.ini"),
                DiskDBlockSize = IniUtils.ReadInteger("DiskD", "BlockSize", 64, "./config.ini"),
                DiskDBlockCount = IniUtils.ReadInteger("DiskD", "BlockCount", 64, "./config.ini"),
                DiskDRecordCount = IniUtils.ReadInteger("DiskD", "RecordCount", 0, "./config.ini"),
                DiskDRootOffset = IniUtils.ReadInteger("DiskD", "RootOffset", 2, "./config.ini"),
                DiskDFileStart = IniUtils.ReadInteger("DiskD", "FileStart", 7, "./config.ini"),
                DiskDTime = IniUtils.ReadString("DiskD", "CreateTime", "", "./config.ini")
            };
        }
    }
}